package com.ssh.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ssh.dao.UserDao;
import com.ssh.entity.User;
import com.ssh.service.UserService;

/**
 * 服务层 做业务逻辑和数据中转
 * @author Administrator
 *
 */
@Service
public class UserServiceImpl implements UserService{
	
	@Autowired
	private UserDao userDao;

	@Override
	public User loadUserByName(String userName,String passWord) {
		return userDao.loadUserByName(userName,passWord);
	}

	@Override
	public int userRegister(User user) {
		if(userDao.selectUserName(user.getUserName()) == 0){
			userDao.userRegister(user);
			return 1;
		}else{
			return 0;
		}
	}
}
